<template>
  <eui-page-frame :topHeight="100">
    <template #top>
      <view style='width:auto;'>
        <eui-nav-bar title='店间调拨' color='#303133' rightIcon='' />
      </view>
    </template>
    <eui-page-content>
      <eui-card vPadding="30" hPadding="20" hMargin="0" radius="24">
        <view class="entry-item flex-column-center" v-for="(item, index) in entryList" :key="index">
          <view class="title flex-start-center">
            {{ item.title }}
            <view class="before" :style="{ background: item.beforeBackground }"></view>
          </view>
          <view class="entry-list flex-row-between">
            <view
                class="list-item flex-column-center"
                v-for="(entryItem, entryIndex) in item.list" :key="entryIndex"
                :style="{ background: entryItem.backgroundColor }"
                @click="handleTo(entryItem)"
            >
              <view class="entry-title flex-start-center">
                <image class="entry-icon" :src="entryItem.iconUrl"></image>
                <view class="title-text">{{ entryItem.title }}</view>
              </view>
              <view class="entry-desc">{{ entryItem.desc }}</view>
            </view>
          </view>
        </view>
      </eui-card>
    </eui-page-content>
  </eui-page-frame>
</template>

<script setup lang="ts">
import { onShow } from '@dcloudio/uni-app';
import { ref } from 'vue'
import useService from '@/hooks/useService';
import { storeToRefs } from 'pinia';
import { useThemeStore } from '@/store/themeStore';
const themeStore = useThemeStore(); // 主题
const { theme } = storeToRefs(themeStore);
const themeColor = ref(theme._object.theme=='theme-blue'?'#02B7E6':'#FF6430')
const service = useService({ prefix: "apiApi" });

const entryList = ref([{
  title: '店间调拨',
  beforeBackground: 'linear-gradient(270deg,#67dcff, #24afff)',
  list: [{
    title: '店间调拨',
    desc: '不同门店商品调拨',
    iconUrl: '../../../static/img/busiImgs/icon_handwork_enquiry.png',
    backgroundColor: '#F5FCFF',
    toUrl: '/pages/BusiViews/StoreTransfer/list'
  }, {
    title: '店内转码调拨',
    desc: '店内不同部门间商品调货',
    iconUrl: '../../../static/img/busiImgs/icon_history_enquiry.png',
    backgroundColor: '#F5FCFF',
    toUrl: '/pages/BusiViews/StoreTransfer/detail'
  }]
}, {
  title: '智能要货',
  beforeBackground: 'linear-gradient(270deg,#ffc26a, #fd722e)',
  list: [{
    title: '转码调拨单报表',
    desc: '门店转码调拨单品统计报表',
    iconUrl: '../../../static/img/busiImgs/icon_template_enquiry.png',
    backgroundColor: '#FFFAF4',
    toUrl: '/pages/BusiViews/StoreTransfer/list'
  }]
}]);

const handleTo = (item: any) => {
  uni.navigateTo({
    url: item.toUrl
  });
}
</script>

<style lang="scss" scoped>

.card {
  border-radius: 16rpx;
  margin: 20rpx;
  background-color: #ffffff;
}

.entry-item {
  &:last-child {
    margin-top: 30rpx;
  }
  .title {
    position: relative;
    padding-left: 18rpx;
    width: 100%;
    height: 42rpx;
    font-size: 30rpx;
    text-align: left;
    color: #222222;
    line-height: 42rpx;
    box-sizing: border-box;
    .before {
      position: absolute;
      left: 0;
      top: 6rpx;
      width: 8rpx;
      height: 30rpx;
      border-radius: 4rpx;
    }
  }

  .entry-list {
    width: 100%;
    gap: 22rpx;
    .list-item {
      justify-content: center;
      width: calc((100% - 22rpx) / 2);
      height: 154rpx;
      margin-top: 20rpx;
      padding: 0 16rpx 0 20rpx;
      border-radius: 16rpx;
      box-sizing: border-box;
      .entry-title {
        width: 100%;
        .entry-icon {
          width: 50rpx;
          height: 50rpx;
          margin-right: 20rpx;
        }
        .title-text {
          height: 40rpx;
          font-size: 28rpx;
          text-align: left;
          color: #222222;
          line-height: 40rpx;
        }
      }
      .entry-desc {
        width: 100%;
        height: 34rpx;
        margin-top: 10rpx;
        font-size: 24rpx;
        text-align: left;
        color: #999999;
        line-height: 34rpx;
      }
    }
  }
}

.e-attachment {
  align-items: center;
  justify-content: center;
  display: flex;

  &__image {
    width: 230rpx;
    height: 230rpx;
    margin: 12rpx;
    border-radius: 10rpx;
  }
}
</style>